/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

/**
 * Autogenerated by Thrift
 *
 * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
 */
package org.apache.hadoop.hbase.thrift.generated;

import java.util.ArrayList;
import java.util.AbstractMap;
import java.util.HashMap;
import java.util.HashSet;
import com.facebook.thrift.*;

import com.facebook.thrift.protocol.*;
import com.facebook.thrift.transport.*;

/**
 * A ScanEntry contains the row, column, and value information for a scanner's
 * current location.
 */
public class ScanEntry implements TBase, java.io.Serializable {
  public byte[] row;
  public AbstractMap<byte[],byte[]> columns;

  public final Isset __isset = new Isset();
  public static final class Isset {
    public boolean row = false;
    public boolean columns = false;
  }

  public ScanEntry() {
  }

  public ScanEntry(
    byte[] row,
    AbstractMap<byte[],byte[]> columns)
  {
    this();
    this.row = row;
    this.__isset.row = true;
    this.columns = columns;
    this.__isset.columns = true;
  }

  public void read(TProtocol iprot) throws TException {
    TField field;
    iprot.readStructBegin();
    while (true)
    {
      field = iprot.readFieldBegin();
      if (field.type == TType.STOP) { 
        break;
      }
      switch (field.id)
      {
        case 1:
          if (field.type == TType.STRING) {
            this.row = iprot.readBinary();
            this.__isset.row = true;
          } else { 
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        case 2:
          if (field.type == TType.MAP) {
            {
              TMap _map0 = iprot.readMapBegin();
              this.columns = new HashMap<byte[],byte[]>(2*_map0.size);
              for (int _i1 = 0; _i1 < _map0.size; ++_i1)
              {
                byte[] _key2;
                byte[] _val3;
                _key2 = iprot.readBinary();
                _val3 = iprot.readBinary();
                this.columns.put(_key2, _val3);
              }
              iprot.readMapEnd();
            }
            this.__isset.columns = true;
          } else { 
            TProtocolUtil.skip(iprot, field.type);
          }
          break;
        default:
          TProtocolUtil.skip(iprot, field.type);
          break;
      }
      iprot.readFieldEnd();
    }
    iprot.readStructEnd();
  }

  public void write(TProtocol oprot) throws TException {
    TStruct struct = new TStruct("ScanEntry");
    oprot.writeStructBegin(struct);
    TField field = new TField();
    if (this.row != null) {
      field.name = "row";
      field.type = TType.STRING;
      field.id = 1;
      oprot.writeFieldBegin(field);
      oprot.writeBinary(this.row);
      oprot.writeFieldEnd();
    }
    if (this.columns != null) {
      field.name = "columns";
      field.type = TType.MAP;
      field.id = 2;
      oprot.writeFieldBegin(field);
      {
        oprot.writeMapBegin(new TMap(TType.STRING, TType.STRING, this.columns.size()));
        for (byte[] _iter4 : this.columns.keySet())        {
          oprot.writeBinary(_iter4);
          oprot.writeBinary(this.columns.get(_iter4));
        }
        oprot.writeMapEnd();
      }
      oprot.writeFieldEnd();
    }
    oprot.writeFieldStop();
    oprot.writeStructEnd();
  }

  public String toString() {
    StringBuilder sb = new StringBuilder("ScanEntry(");
    sb.append("row:");
    sb.append(this.row);
    sb.append(",columns:");
    sb.append(this.columns);
    sb.append(")");
    return sb.toString();
  }

}

